<%@ page import="com.google.gdata.data.photos.*"%>
<%@ page import="com.google.gdata.client.photos.*"%>
<%@ page import="com.google.gdata.data.media.*"%>
<%@ page import="com.google.gdata.data.*"%>
<%@ page import="com.google.gdata.data.media.mediarss.MediaThumbnail"%>
<%@ page import="java.io.*"%>
<%@ page import="java.net.*"%>
<%@ page import="java.util.*"%>
<%
PicasawebService myService = new PicasawebService("bafa-test-2");
myService.setUserCredentials("r.hmeid@gmail.com", "socrat3s");

URL postUrl =
  new URL("http://picasaweb.google.com/data/feed/api/user/r.hmeid/album/bafa");
  // Send the request for the album's photos.

PhotoEntry myPhoto = new PhotoEntry();
myPhoto.setTitle(new PlainTextConstruct("new.jpg"));
myPhoto.setDescription(new PlainTextConstruct("New Photo"));
myPhoto.setClient("OR Rovers");
myPhoto.setTimestamp (new Date());
MediaFileSource myMedia = new MediaFileSource(new File("d:/new.jpg"), "image/jpeg");
myPhoto.setMediaSource(myMedia);

PhotoEntry returnedPhoto = myService.insert(postUrl, myPhoto);
List thumbnails = returnedPhoto.getMediaThumbnails();

MediaThumbnail media = (MediaThumbnail)thumbnails.get(thumbnails.size()-1);
out.println(media.getUrl());
%>